export const formOption = ref({
  inline: true,
  showResetButton: true,
})
import { userAuthList } from "@/Auth/user.js"
import { isPermission } from "@/hooks/permission.js"
export const fieldList = ref([
  {
    field: "noRange",
    placeholder: "可批量搜索",
    type: "textarea",
    style: { width: "240px" },
    selectStyle: { width: "120px" },
    select: [
      { label: "平台订单号", value: "ClientOrderCode" },
      { label: "客户ID", value: "ClientUserAccount" },
    ],
  },

  // {
  //   field: "RefundStatus",
  //   type: "select",
  //   options: {
  //     placeholder: "退款类型",
  //     data: [
  //       { label: "未退款", value: "0" },
  //       { label: "部分退款", value: "1" },
  //       { label: "全部退款", value: "2" },
  //     ],
  //   },
  //   style: { width: "140px" },
  // },
])
// 操作
export const handleFunctions = ref({})

export const tablecColumns = ref([
  {
    params: "left",
    minWidth: 200,
    title: "订单信息",
    slots: {
      default: ({ row }) => {
        return (
          <div>
            <VText title="平台单号" value={row.ClientOrderCode} line={1} />
            <VText title="赛盒订单号" value={row.OrderCode} line={1} type="link" />
            <VText title="平台" value={row.OrderSourceType} line={1} />
            <VText title="客户ID" value={row.ClientUserAccount} line={1} />
            <VText title="店铺" value={row.OrderSourceName} line={1} />
            <VText title="类型" value={row.IsFBAOrderDesc} line={1} />

            {isPermission([userAuthList.irobotbox.add]) && (
              <el-button type="primary" size="small" class="mt-[6px]" onClick={() => handleFunctions?.value?.openAddRefund(row)}>
                申请退款
              </el-button>
            )}

            <el-button type="primary" size="small" class="mt-[6px]" onClick={() => handleFunctions?.value?.openLog(row)}>
              日志
            </el-button>
          </div>
        )
      },
    },
  },
  {
    title: "商品信息",
    width: 350,
    slots: { default: "GoodsSlot" },
  },
  {
    title: "订单状态",
    width: 150,
    slots: {
      default: ({ row }) => {
        return (
          <div>
            <VText title="付款状态" value={row.IsPayDesc} line={1} />
            <VText title="发货状态" value={row.OrderStateDesc} line={1} />
          </div>
        )
      },
    },
  },
  {
    title: "订单金额",
    minWidth: 200,
    slots: {
      default: ({ row }) => {
        return (
          <div>
            <VText title="订单金额" value={`${row.Currency} ${row.TotalPrice}`} line={1} />
            <VText title="产品总价" value={`${row.Currency} ${row.ProductTotalPrice?.toFixed(2)}`} line={1} />
            {row?.RefundPrice ? <VText title="全部退款" value={`${row.Currency} ${row?.RefundPrice || ""}`} line={1} class="text-red" /> : ""}
          </div>
        )
      },
    },
  },

  {
    title: "发货信息",
    minWidth: 280,
    slots: {
      default: ({ row }) => {
        return (
          <div>
            <VText title="地址" value={row.Address} line={1} type="link" onClick={() => handleFunctions?.value?.openAddress(row)} />
            <VText title="平台运输方式" value={row.ShipService} line={1} />
            <VText title="发货仓库" value={row.WareHouse} line={1} />
            <VText title="运输方式" value={row.TransportName} line={1} />
            <VText title="真实追踪号" value={row.TrackNumbers} line={1} />
            <span class="flex">
              <VText title="SKU数" class="s-item" value={row.SkuNum} line={1} />
              <VText title="产品数" class="s-item" value={row.ProductNum} line={1} />
            </span>

            <span class="flex">
              <VText title="体积" class="s-item" value={`${row?.Volume || 0}cm³`} line={1} />
              <VText title="重量" class="s-item" value={`${row?.Weight || 0}g`} />
            </span>
          </div>
        )
      },
    },
  },

  {
    title: "备注信息",
    width: 200,
    slots: {
      default: ({ row }) => {
        return (
          <div>
            <VText title="买家留言" value={row.xxxx} line={2} />
            <VText title="订单留言" value={row.OrderDescription} line={2} />
          </div>
        )
      },
    },
  },

  {
    title: "时间信息",
    width: 200,
    slots: {
      default: ({ row }) => {
        return (
          <div>
            <VText title="添加" value={row.AddTime} line={1} />
            <VText title="修改" value={row.UpdateTime} line={1} />
            <VText title="发货" value={row.ShipTime} line={1} />
          </div>
        )
      },
    },
  },

  {
    title: "操作人员",
    width: 200,
    slots: {
      default: ({ row }) => {
        return (
          <div>
            <VText title="添加" value="admin(超级管理员)" line={1} />
            <VText title="修改" value={row.xxxx} line={1} />
            <VText title="客服" value={row.xxxx} line={1} />
            <VText title="销售" value={row?.Items?.[0]?.BusinessAdminName} line={1} />
          </div>
        )
      },
    },
  },
])
